home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 1
/
Atari Mega Archive - Volume 1.iso
/
mint
/
mint110s.zoo
/
quickmov.spp
< prev
next >
Wrap
Text File
|
1993-08-16
|
2KB
|
63 lines
; Copyright 1992 Eric R. Smith
; Copyright 1993 Atari Corporation
; All rights reserved.
;
; quickmove(char *dst, char *src, long nbytes):
; quickly copy "nbytes" bytes from src to dst. Assumes that both
; src and dst are word aligned.
;
TEXT
XDEF _quickmove
_quickmove:
move.l 4(sp),a0 ; get dst
move.l 8(sp),a1 ; get src
move.l 12(sp),d0 ; get nbytes
lsr.l #8,d0 ;
lsr.l #1,d0 ; d0 = nbytes / 512
subq.l #1,d0 ; prepare for dbra loop
bmi.s Leftover ; if < 0, skip
movem.l d1-d7/a2-a6,-(sp) ; save regs
L1:
movem.l (a1)+,d1-d7/a2-a6 ; read 12*4 = 48 bytes
movem.l d1-d7/a2-a6,(a0) ;
movem.l (a1)+,d1-d7/a2-a6 ; 2nd read
movem.l d1-d7/a2-a6,48(a0) ;
movem.l (a1)+,d1-d7/a2-a6 ; 3rd read
movem.l d1-d7/a2-a6,96(a0) ;
movem.l (a1)+,d1-d7/a2-a6 ; 4th read
movem.l d1-d7/a2-a6,144(a0) ;
movem.l (a1)+,d1-d7/a2-a6 ; 5th
movem.l d1-d7/a2-a6,192(a0) ;
movem.l (a1)+,d1-d7/a2-a6 ; 6th
movem.l d1-d7/a2-a6,240(a0) ;
movem.l (a1)+,d1-d7/a2-a6 ; 7th
movem.l d1-d7/a2-a6,288(a0) ;
movem.l (a1)+,d1-d7/a2-a6 ; 8th
movem.l d1-d7/a2-a6,336(a0) ;
movem.l (a1)+,d1-d7/a2-a6 ; 9th
movem.l d1-d7/a2-a6,384(a0) ;
movem.l (a1)+,d1-d7/a2-a6 ; 10th
movem.l d1-d7/a2-a6,432(a0) ; At this point, 480 bytes done
movem.l (a1)+,d1-d7/a2 ; Only do 32 more bytes
movem.l d1-d7/a2,480(a0) ; for a total of 512
lea 512(a0),a0
subq.l #1,d0
bge.s L1
movem.l (sp)+,d1-d7/a2-a6 ; pop registers
Leftover: ; do the remaining bytes
move.l 12(sp),d1
and.w #$01ff,d1 ; d1 = nbytes % 512
subq.w #1,d1 ; prepare for dbra loop
bmi.s Ldone
L2:
move.b (a1)+,(a0)+
dbra d1,L2
Ldone:
rts ; return
END